package com.gongjian.web.controller;

        import com.gongjian.database.entity.Classe;
        import com.gongjian.database.entity.Classes;
        import com.gongjian.database.service.ClassService;
        import com.gongjian.utile.Ids;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.web.bind.annotation.RequestBody;
        import org.springframework.web.bind.annotation.RequestMapping;
        import org.springframework.web.bind.annotation.RestController;

@RestController
public class ClasseController {
    @Autowired
    ClassService classService;
    //SQL查询班级信息
    @RequestMapping("/class/findAllClasse")
    public String findAllClasse(@RequestBody Classes classes){
        return classService.findAllClasse(classes.getPage(),classes.getPageSzie(),classes);
    }
    // 根据班级ID查看该班级的学生
    @RequestMapping("/class/findUserClasse")
    public String findUserClasse(@RequestBody Classes classes){
        return classService.findUserClasse(0,0,classes);
    }


    //给班级添加单个学生(中间表)
    @RequestMapping("/class/addUsersClass")
    public String addUsersClass(@RequestBody Classes classes){
        return classService.addUsersClass(classes);
    }

    //根据班级ID修改班级编号或者辅导员
    @RequestMapping("/class/updateClass")
    public String updateClass(@RequestBody Classes classes) {
        return classService.updateClass(classes);
    }

    //添加班级
    @RequestMapping("/class/addClass")
    public String addClass(@RequestBody Classes classes){
        return classService.addClass(classes);
    }

    //删除班级及中间表
    @RequestMapping("/class/deleteClass")
    public String deleteClass(@RequestBody Ids ids){
        System.out.println(ids.getIds());
        return classService.deleteClass(ids.getIds());
    }
    //删除班级的学生
    @RequestMapping("/classe/deleteClasseUser")
    public String deleteClasseUser(int userId){
        System.out.println(userId+">>>>>>>>>>");
        return classService.deleteClasseUser(userId);
    }


}
